#include "lineconfigdialog.h"

#include <QHBoxLayout>
#include <QSpinBox>

CLineConfigDialog::CLineConfigDialog(QWidget *parent)
    : QWidget(parent)
    , m_PenWidth(this)
{
    Init();
}

void CLineConfigDialog::SetPenWidth(int nWidth)
{
    m_width = nWidth;
    m_PenWidth.setValue(m_width);
}

void CLineConfigDialog::PenWidthChangedSlot(int nWidth)
{
    m_width = nWidth;
    emit PenWidthChanged(nWidth);
}

void CLineConfigDialog::Init()
{
    QHBoxLayout *pMainLayout = new QHBoxLayout(this);
    m_PenWidth.setValue(m_width);
    pMainLayout->addWidget(&m_PenWidth);
    connect(&m_PenWidth, QOverload<int>::of(&QSpinBox::valueChanged), this, &CLineConfigDialog::PenWidthChangedSlot);
}
